17. Phonebook Commands > 17.3 AT+CPBR   Read from Phonebook

17.3
AT+CPBR   Read from Phonebook
AT+CPBR serves to read one or more entries from the phonebook selected with AT command AT+CPBS.

The AT+CPBR test command returns the location range supported by the current phonebook storage, the maxi­mum length of <number> field and the maximum length of <text> field.
Note: Length information may not be available while SIM storage is selected. If storage does not offer format information, the format list contains empty parenthesizes.

The AT+CPBR write command determines the phonebook entry to be displayed with <location1> or a location range from <location1> to <location2>. Hence, if no <location2> is given only the entry at <location1> will be displayed.
If no entries are found at the selected location "OK" will be returned.
Syntax
Test Command  
Response(s)
Write Command  
Response(s)
Reference(s) 
PIN 
ASC0 
ASC1 
USB 
MUX1 
MUX2 
MUX3 
Charge 
Last 
GSM 07.07, GSM 11.11

Parameter Description
 
The first (lowest) location number within phonebook memory where to start reading. The maximum range sup­ported by the current phonebook is given in the test command response.
If <location1> exceeds the upper bound <maxloc> (as indicated by the test command), command will respond with "+CME ERROR: invalid index".
 
The last (highest) location number within phonebook memory where to stop reading. The maximum range sup­ported by the current phonebook is given in the test command response.
If both <location1> and <location2> are in the range indicated by the test command parameter <max­loc>, the list of entries will be output and terminated with "OK".
If <location2> exceeds the range indicated by the test command parameter <maxloc>, the list of entries will be output but terminated with "+CME ERROR: invalid index".
Note: The maximum value of <location2> is 255, regardless of the phonebook type and its range indicated by <maxloc>. If a value greater than 255 is used the query returns no phonebook records, and only "+CME ERROR: invalid index" is shown.
 
Phone number in format specified by <type>, it may be an empty string.
 
<type>(num)
Type of address octet, which defines the used type of number (ton) and the numbering plan identification (npi).
Please consider that for types other than 129 or 145 dialing from phonebook with ATD><mem><n> is, depending on the network, not always possible (refer to GSM 04.08 subclause 10.5.4.7 for details). See also <type> of AT+CPBW.
Possible values are:
145
Dialing string <number> includes international access code character '+'
161
National number. Network support of this type is optional.
209
Dialing string <number> has been saved as ASCII string and includes non-digit characters other than "*", "#" or "+". Note that phonebook entries saved with this type cannot be dialed.
255
Dialing string <number> is a command to control a Supplementary Service, i.e. "*", "#" codes are contained. Network support of this type is optional.
129
Otherwise
 
<text>(str)(+CSCS)
Text assigned to a phone number. The maximum length for this parameter is given with test command response parameter <tlength>.
If using an ASCII terminal characters which are coded differently in ASCII and GSM have to be entered via escape sequences as described in Section 1.5, Supported character sets.
 
Maximum location number for the currently selected storage. For phonebooks located on the SIM this value depends on the SIM card type.
 
Maximum length of phone number for "normal" locations. Depending on the storage a limited number of loca­tions with extended memory is available per phonebook. These locations allow storing numbers with twice the standard length, which is 2*<nlength> digits for normal numbers, but only <nlength> digits for numbers saved with <type>=209.
 
Maximum length of <text> assigned to the telephone number. The value indicated by the test command is given in octets. If <text> is given as GSM characters each character corresponds to one octet. If the <text> string is given in UCS2, the maximum number of characters depends on the coding scheme used for the alpha field of the SIM according to GSM 11.11, Annex B [26]. In the worst case the number of UCS2 characters is at least one less than half the number of GSM characters.


Note
•
Users should be aware that when using this AT command quickly after SIM PIN authentication the SIM data may not yet be accessible, resulting in a short delay before the requested AT command response is returned. See Section 23.1, Restricted access to SIM data after SIM PIN authentication for further detail.

 
Example
 
First run the AT+CPBR test command to find out the maximum range of entries stored in the active phonebook.
TC65 returns the supported values, where 100 is the supported range of location numbers, 20 is the length of the phone number and 17 is the maximum length of the associated text.
Then use the AT+CPBR write command to display the phonebook entries sorted by location numbers.